<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Login</title>

    <!--gritter-->
    <link rel="stylesheet" type="text/css" href="../js/gritter/css/jquery.gritter.css" />

    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="login-body">

<div class="container">

    <form class="form-signin" id="form1" method="post" action="">
        <div class="form-signin-heading text-center">
            <h1 class="sign-title">闯奇DSP系统</h1>
            <img src="images/login-logo.png" alt=""/>
        </div>
        <div class="login-wrap">
            <input type="text" class="form-control" name="email" required placeholder="请输入您的邮箱" autofocus>
            <input type="password" class="form-control" name="password" required placeholder="请输入您的密码">

            <button class="btn btn-lg btn-login btn-block" type="submit">
                <i class="fa fa-check"></i>
            </button>
        </div>

    </form>

</div>



<!-- Placed js at the end of the document so the pages load faster -->

<!-- Placed js at the end of the document so the pages load faster -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.min.js"></script>
<!-- validate -->
<script src="js/jquery.validate.min.js"></script>
<script src="js/http.js"></script>

<!-- isloading -->
<script src="js/jquery.isloading.js"></script>

<script type="text/javascript" src="js/cookie.js"></script>
<!-- gritter -->
<script type="text/javascript" src="js/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript">
(function() {
    "use strict";
    var mygritter = function(content){
      $.gritter.add({
          title: '温馨提示',
          text: content,
          time: 3000
      });
    };
    $("#form1").validate({
      messages:{
        email:"请输入您的邮箱",
        password:"请输入您的密码"
      },
      submitHandler:function(form){
          var params = $(form).serialize();
          myHttp.postJSON("login",params,function(data){
            mygritter("登录成功");
            var params = $(form).serialize();
            var user = {
              type     : "admin",
              username : data.name,
              id       : data.id,
              account  : form.email.value
            };
            sessionStorage.setItem("user",JSON.stringify(user));
            window.location.href = "index.html";
          },function(){
            mygritter("登录失败");
          });
      }
    });
})(jQuery);
</script>
</body>
</html>
